package com.ews.onlineexchange.service.observer;

import java.io.IOException;
import java.net.URISyntaxException;

import javax.ejb.Asynchronous;
import javax.ejb.Stateless;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import javax.websocket.DeploymentException;
import com.ews.onlineexchange.model.ShortMessage;
import com.ews.onlineexchange.service.EmailService;
import com.ews.onlineexchange.service.qualifier.SendEmailEvent;

@Stateless
public class SendEmailObserver {
	
	@Inject
	EmailService emailService;
	@Asynchronous
	public void listenBulletinAudit(@Observes @SendEmailEvent ShortMessage shortMessage) throws DeploymentException, IOException, URISyntaxException {
		emailService.sendFailNotification(shortMessage);
	}
	
}
